﻿<Window x:Class="WPFDemo.addCustomGroup"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:custom="clr-namespace:WPFDemo"
        Title="カスタムグループ追加/削除" Height="350" Width="350" Loaded="Window_Loaded_1">
    <Window.Resources>
        <DataTemplate x:Key="GroupInfoTemplate" DataType="WPFDemo.GroupInfo">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="{Binding GroupName}" Margin="3" Width="160"/>
                <TextBlock Grid.Column="1" Text="{Binding Type}" Margin="3" Width="100"/>
                <TextBlock Grid.Column="2" Text="{Binding ContactNumber}" Margin="3" Width="40"/>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <TextBlock Grid.Column="0" Text="カスタムグループ:" Margin="7,13,252.333,284.667"/>
        <TextBox x:Name="CustomGroupNameTextBox" Margin="102,11,59.333,284.667"/>
        <Button x:Name="AddCustomGroupButton" Content="+" HorizontalAlignment="Left" Margin="296,11,0,0" 
    		VerticalAlignment="Top" Width="17" Click="AddCustomGroupButton_Click" Height="20"/>

        <Button x:Name="RemoveCustomGroupButton" Content="-" HorizontalAlignment="Left"  Height="20"
    		Margin="317,11,0,0" VerticalAlignment="Top" Width="17" Click="RemoveCustomGroupButton_Click"/>
        <TextBlock Text="すべてのグループ:" Margin="7,45,1.333,251.667"/>
        <ListBox  x:Name="groupListBox" Margin="8,73,4.333,3.667" ItemsSource="{Binding Groups}" ItemTemplate="{StaticResource GroupInfoTemplate}"  VerticalAlignment="Stretch" SelectionChanged="groupListBox_SelectionChanged" />
    </Grid>
</Window>
